import {Message, MessageBox} from "element-ui";

export const ResponseHandle = {
    isOk: (res) => {
        return res && res.code === 200
    }
}

export const CommUtil = {
    toPlainObject: (obj) => {
        return JSON.parse(JSON.stringify(obj));
    }
}

export const ShowMessage = (res) => {
    if (typeof res === "string") {
        Message.info(res);
        return;
    }
    if (res && res.code === 200) {
        Message.success(res.msg);
    } else {
        Message.error(res.msg);
    }
}